<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="vtc" uri="/ls-trade-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<title>Endorsement</title>
	
	<script type="text/javascript">
		function clickBtn(action) {
			switch (action) {
			case "search":
				$("#mainForm").attr("action", "endorsement!search.action");
				break;
			case "clear":
				$("#mainForm").attr("action", "endorsement!clear.action");
				break;
			}
	
			$("#mainForm").submit();
		}
	</script>

</head>
<body>


<div class="content">
	<div class="pageTitle">Endorsement Management</div>
	<div class="form1">
		<s:form id="mainForm" name="mainForm" method="post" action="endorsement!search.action">
			<s:hidden name="search" value="true"></s:hidden>
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="sep"><img src="../images/spacer.gif"
					style="width: 180px;" />
				</td>
				<td class="sep sep2"><img src="../images/spacer.gif" />
				</td>
			</tr>
			<tr>
				<td><label class="fLabel">Planning Exercise</label>
					<div class="fField">
						<s:select id="planningExercise" name="planningExercise"
								list="categoryService.allCategoryOrderByYear"
								listKey="key" listValue="value" 
								headerKey="" headerValue="-All-"
								cssStyle="width: 180px"></s:select>
					</div>
				</td>
				<td><label class="fLabel">Level of Planning </label>
					<div class="fField">
						<s:select id="planningLevel" name="planningLevel"
								list="@com.lightsaber.trade.as.entity.planning.PlanningLevel@list()"
								listKey="key" listValue="value" headerKey="" headerValue="-All-"
								cssStyle="width: 180px"></s:select>
					</div>
				</td>
			</tr>
		</table>
		<div class="btnSet btnSetTypeB">
				<div class="left">
					<div class="button">
						<div class="left">
							<div class="right">
								<input class="inputButton" type="button" id="" name=""
									value="Search" onclick="clickBtn('search')" />
							</div>
						</div>
					</div>
					<div class="button">
						<div class="left">
							<div class="right">
								<input class="inputButton" type="button" id="" name=""
									value="Clear" onclick="clickBtn('clear')" />
							</div>
						</div>
					</div>
				</div>
		</div>
			
		<s:if test="%{page!=null&&page.result!=null&&page.result.size()!=0}">
			<div class="sListBorder">
				<div class="sList">
					<table width="100%" class="sTable" cellpadding="0" cellspacing="0" border="0" >
	                    <tr>
	                      <td class="sTh t" >Planning Exercise</td>
	                      <td class="sTh t" >Planning Exercise Name </td>
	                      <td class="sTh t" >Level</td>
	                      <td class="sTh t" >Status</td>
	                    </tr>
	                                
						<s:iterator value="page.result" var="planning" status="st">
	
							<s:set var="trClass" value="'sRow1'"></s:set>
							<s:if test="#st.index%2==0">
								<s:set var="trClass" value="'sRow2'"></s:set>
								<s:else>
									<s:set var="trClass" value="'sRow1'"></s:set>
								</s:else>
							</s:if>
	                        <tr class="<s:property value='#trClass'/>">
	                          <td class="sCell" ><s:property value="#planning.category.planYear" /></td>
	                          <td class="sCell" ><s:property value="#planning.category.planningExerciseName" /></td>
	                          <td class="sCell" ><a href="endorsement!turnToEditPage.action?planningId=<s:property value='#planning.id' />" ><s:property value="#planning.planningLevel.label" /></a></td>
	                          <td class="sCell" ><s:property value="#planning.status" /></td>
	                        </tr>
						</s:iterator>
	               </table>
					
				</div>
				  <vtc:paging page="%{page}"></vtc:paging>
			</div>
		</s:if>
	
	</s:form>
	</div>
	<!-- InstanceBeginEditable name="content" -->


	<!-- InstanceEndEditable -->
</div>

</body>
</html>